package com.kgc.kmall.managerservice.service;

import com.kgc.kmall.bean.*;
import com.kgc.kmall.service.CatalogService;
import org.apache.dubbo.config.annotation.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CatalogServiceImpl implements CatalogService {

    @Resource
    PmsBaseCatalog1Mapper pmsBaseCatalog1Mapper;
    @Resource
    PmsBaseCatalog2Mapper pmsBaseCatalog2Mapper;
    @Resource
    PmsBaseCatalog3Mapper pmsBaseCatalog3Mapper;

    public List<PmsBaseCatalog1> getCatalog1() {
        List<PmsBaseCatalog1> pmsBaseCatalog1s = pmsBaseCatalog1Mapper.selectByExample(null);
        return pmsBaseCatalog1s;
    }

    @Override
    public List<PmsBaseCatalog2> getCatalog2(Integer catelog1Id) {
        PmsBaseCatalog2Example example=new PmsBaseCatalog2Example();
        example.createCriteria().andCatalog1IdEqualTo(catelog1Id);
        List<PmsBaseCatalog2> PmsBaseCatalog2 = pmsBaseCatalog2Mapper.selectByExample(example);
        return PmsBaseCatalog2;
    }

    @Override
    public List<PmsBaseCatalog3> getCatalog3(Integer catelog2Id) {
        PmsBaseCatalog3Example example=new PmsBaseCatalog3Example();
        example.createCriteria().andCatalog2IdEqualTo((long)catelog2Id);
        List<PmsBaseCatalog3> PmsBaseCatalog3 = pmsBaseCatalog3Mapper.selectByExample(example);
        return PmsBaseCatalog3;
    }
}